﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Content.Master" Inherits="System.Web.Mvc.ViewPage<MethodWorx.CMS.UI.Areas.Dashboard.Models.DashboardModel>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
	Index
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <script language="javascript">
        $(document).ready(function () {
            refreshWidgets();

            $("#Plugin").change(refreshWidgets);
        });

        function refreshWidgets() {
            $.getJSON("<%=Url.Content("~/Dashboard")%>/Dashboard/GetWidgets/" + $("#Plugin").val(), function (result) {
                var html = "";
                for (var i = 0; i < result.length; i++) {
                    var checked = "";
                    if (result[i].Selected == true)
                        checked = "checked=\"true\"";
                    html += "<div><input name=\"widgets\" value=\"" + result[i].Id + "\" type=\"checkbox\" " + checked + ">" + result[i].Title + "</div>";
                }
                $("#widgets").html(html);
            });
        }
    </script>    
    <%using (Html.BeginForm()) { %>

     <div id="columns">
        
        <ul id="column1" class="column">
            <li class="widget color-white" id="configuration">
                <div class="widget-head">
                    <h3>Dashboard Configuration</h3>
                </div>
                <div class="widget-content">
                    <div class="formItem">
                        <label>Plugin:</label>
                        <%=Html.DropDownList("Plugin", this.Model.GetPluginsSelectList(), new { style = "width:250px" })%>
                    </div>
                    <div class="formItem">
                        <label>Dashboard Widgets:</label>
                        <div style="width:250px;height:100px;background-color:white;border:1px solid silver;overflow:auto" id="widgets">
                        </div>
                    </div>
                    <div class="formItem">
                        <button name="submit" value="apply">Apply</button>
                        <button>Reset</button>
                    </div>
                </div>
            </li>
            <%foreach (var widget in this.Model.GetWidgets(0))
              { %>
               <li class="widget color-white">
                <div class="widget-head">
                    <h3><%:widget.Title %></h3>
                </div>
                <div class="widget-content">
                    <iframe style="width:100%;height:<%=widget.Height%>px;border:none;" src="<%=Url.Content(widget.Url) %>" scrolling="no">
                    </iframe>
                </div>
            </li>
            <%} %>
           
          

        </ul>

        <ul id="column2" class="column">
            
        </ul>

        <ul id="column3" class="column">
            
        </ul>
        
    </div>

    <%} %>
   <link href="<%=Url.Content("~/css/inettuts.css")%>" rel="stylesheet" type="text/css" />
   <link href="<%=Url.Content("~/css/inettuts.js.css")%>" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="<%=Url.Content("~/scripts/inettuts.js")%>"></script>



</asp:Content>
